<?php

/**
 * PersonalInformation form base class.
 *
 * @method PersonalInformation getObject() Returns the current form's model object
 *
 * @package    ecrm
 * @subpackage form
 * @author     Saul Santiago
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePersonalInformationForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'first_name'      => new sfWidgetFormInputText(),
      'last_name'       => new sfWidgetFormInputText(),
      'middle_name'     => new sfWidgetFormInputText(),
      'contact_no'      => new sfWidgetFormInputText(),
      'mobile_no'       => new sfWidgetFormInputText(),
      'address1'        => new sfWidgetFormTextarea(),
      'street'          => new sfWidgetFormTextarea(),
      'barangay'        => new sfWidgetFormTextarea(),
      'city_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('City'), 'add_empty' => true)),
      'zip_code'        => new sfWidgetFormInputText(),
      'fax_no'          => new sfWidgetFormInputText(),
      'tin'             => new sfWidgetFormInputText(),
      'sss_gsis'        => new sfWidgetFormInputText(),
      'passport_no'     => new sfWidgetFormInputText(),
      'passport_expiry' => new sfWidgetFormInputText(),
      'citizenship'     => new sfWidgetFormInputText(),
      'civil_status'    => new sfWidgetFormInputText(),
      'spouse_name'     => new sfWidgetFormInputText(),
      'status'          => new sfWidgetFormInputCheckbox(),
      'is_primary'      => new sfWidgetFormInputCheckbox(),
      'title'           => new sfWidgetFormInputText(),
      'kids'            => new sfWidgetFormInputText(),
      'birthdate'       => new sfWidgetFormDate(),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'first_name'      => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'last_name'       => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'middle_name'     => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'contact_no'      => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'mobile_no'       => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'address1'        => new sfValidatorString(array('max_length' => 256, 'required' => false)),
      'street'          => new sfValidatorString(array('max_length' => 256, 'required' => false)),
      'barangay'        => new sfValidatorString(array('max_length' => 256, 'required' => false)),
      'city_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('City'), 'required' => false)),
      'zip_code'        => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'fax_no'          => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'tin'             => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'sss_gsis'        => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'passport_no'     => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'passport_expiry' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'citizenship'     => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'civil_status'    => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'spouse_name'     => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'status'          => new sfValidatorBoolean(array('required' => false)),
      'is_primary'      => new sfValidatorBoolean(array('required' => false)),
      'title'           => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'kids'            => new sfValidatorInteger(array('required' => false)),
      'birthdate'       => new sfValidatorDate(array('required' => false)),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('personal_information[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PersonalInformation';
  }

}
